<?php 

require_once "classes/base/Tratador.class.php";
require_once "classes/base/ParametrosAcao.class.php";

require_once "classes/forms/".$_GET['classe'].".class.php";
 
session_start();

$parametros = new ParametrosAcao($_POST, $_GET, $_SERVER['HTTP_REFERER'], $_FILES);
$tratador = new Tratador($parametros);
$tratador->atualizaValoresForm();
$tratador->chamaInitForm();
$redirecao = $tratador->executaMetodoClasse();
$tratador->finalizaValoresForm();

$url = parse_url($redirecao);
$urlnova = $url['path'] . "?";
$arrayquery = explode('&', $url['query']);
if ($arrayquery[0] == 'complete=1') {
	$urlnova = $url['path']."?".$url['query'];
}
else if ($arrayquery[1] != 'force=1')
	$urlnova .= $arrayquery[0];
else 
	$urlnova = $redirecao;
			
header("Location: ".$urlnova);


?>